import {createRouter, createWebHistory} from 'vue-router'
import Layout from '@/layout/index.vue'
/**
 * icon使用的fontawesome    https://fontawesome.dashgame.com/
 */

const routerHistory = createWebHistory()
 
const router = createRouter({
    history: routerHistory,
    routes: [
        { 
            path: '/', 
            redirect: '/login',
            meta:{
                MenuHide:true,//是否在侧边栏菜单中隐藏
            }
        },
        { 
            path: '/login', 
            component: () => import("@/views/login/index.vue"),
            meta:{
                MenuHide :true,//是否在侧边栏菜单中隐藏
            }
        },
        {
            path: '/index',
            component: Layout,
            name: '表格',
            meta: { title: '表格', icon: 'fa-indent' },
            children: [{
              path: '/index',
              name: '表格',
              component: () => import("@/views/index/index.vue"),
              meta: { title: '表格', icon: 'fa-indent',MenuHide :true }
            }]
        },
        {
            path: '/twoLevel',
            name: '二级路由',
            meta: { title: '二级路由', icon: 'fa-cog' },
            component: Layout,
            children: [
                {
                    path: '/twoLevel/twoLevelOne',
                    name: '富文本',
                    component: () => import("@/views/twoLevel/twoLevelOne.vue"),
                    meta: { title: '富文本', icon: 'fa-cog' }
                },
                {
                    path: '/twoLevel/twoLevelTwo',
                    name: '二级2',
                    component: () => import("@/views/twoLevel/twoLevelTwo.vue"),
                    meta: { title: '二级2', icon: 'fa-cog' }
                },
            ]
        },
        {
            path: '/level',
            name: '三级路由',
            meta: { title: '三级路由', icon: 'fa-cog' },
            component: Layout,
            children: [
                {
                    path: '/level/index',
                    name: '二级',
                    component: () => import("@/layout/components/AppMain.vue"),
                    meta: { title: '二级', icon: 'fa-cog' },
                    children: [
                        {
                            path: '/level/index/index',
                            name: '三级',
                            component: () => import("@/views/level/index.vue"),
                            meta: { title: '三级', icon: 'fa-cog' }
                        },
                    ]
                },
            ]
        },
        //这里404不可直接写*，应按下方写
        {
            path: "/:catchAll(.*)",
            component: () => import("@/views/404/index.vue"),
            meta:{
                MenuHide:true,//是否在侧边栏菜单中隐藏
            }
        },
    ]
})
export default router;